using System;
using System.Threading.Tasks;
using UnityEngine;

public class AsyncAwaitExample : MonoBehaviour
{
    private async void Start()
    {
        Debug.Log("开始异步任务");
        // 调用异步方法
        await LongRunningTaskAsync();
        Debug.Log("异步任务完成");
    }

    private async Task LongRunningTaskAsync()
    {
        // 模拟耗时操作
        await Task.Delay(5000);
        Debug.Log("耗时操作完成");
    }
}